<template>
  <div class="CustomerList">
    <!-- header -->
    <new-header title="家庭作业" />
    <!-- 4个选择 -->
    <div class="center">
      <!-- 班级选择 -->
      <div class="class-body">
        <span class="name">班级选择:</span>
        <div class="right">
          <span
            v-for="item of 3"
            :key="item"
            :class="{'active':active_class === item}"
            class="right-btn"
            @click="change_class(item)"
          >初二{{ item }}班</span>
        </div>
      </div>
      <div class="class-body">
        <span class="name">适合学段:</span>
        <div class="right">
          <span
            v-for="item of 3"
            :key="item"
            :class="{'active':active_class === item}"
            class="right-btn"
            @click="change_class(item)"
          >初二{{ item }}班</span>
        </div>
      </div>
      <div class="class-body">
        <span class="name">训练难度:</span>
        <div class="right">
          <span
            v-for="item of 3"
            :key="item"
            :class="{'active':active_class === item}"
            class="right-btn"
            @click="change_class(item)"
          >初二{{ item }}班</span>
        </div>
      </div>
      <div class="class-body">
        <span class="name">训练目的:</span>
        <div class="right">
          <span
            v-for="item of 3"
            :key="item"
            :class="{'active':active_class === item}"
            class="right-btn"
            @click="change_class(item)"
          >初二{{ item }}班</span>
        </div>
      </div>
    </div>
    <!-- 选择列表 -->
    <div class="list">
      <div
        v-for="item of 12"
        :key="item"
        class="item"
        @click="go_to_detail(item)"
      >
        <div class="title">
          <img src="@/assets/login_images/z1.png" alt="">
          <h1>家庭作业</h1>
        </div>
        <div class="item-c">
          <span>难度</span>
          <div class="detail">
            <img src="@/assets/login_images/star-line.png" alt="">
            <img src="@/assets/login_images/star-line.png" alt="">
            <img src="@/assets/login_images/star-line.png" alt="">
          </div>
        </div>
        <div class="item-c">
          <span>训练目的</span>
          <div class="detail">中考专项</div>
        </div>
        <div class="item-c">
          <div class="detail">6-8岁</div>
          <div class="detail">25分钟</div>
        </div>
        <div class="bot">选择</div>
      </div>

    </div>
    <el-pagination
      class="pagin"
      background
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="this.size"
      layout="prev, pager, next, sizes,  jumper,total"
      :total="this.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
  </div>
</template>

<script>
import NewHeader from '@/components/NewHeader.vue'
export default {
  name: 'WorkSelect',
  components: {
    NewHeader
  },
  data() {
    return {
      active_class: 1,
      currentPage: 1,
      size: 10,
      total: 100
    }
  },
  mounted() {

  },
  methods: {
    change_class(index) {
      console.log(index)
      this.active_class = index
    },
    // 页面size改变
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.size = val
      this.get_customer_list()
    },
    // 页面page改变
    handleCurrentChange(val) {
      this.currentPage = val
      this.get_customer_list()
    },
    go_to_detail(item) {
      this.$router.push({ path: '/work/work-detail/' + item })
    }
  }
}
</script>

<style lang="scss" scoped>
.list{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  .item{
    width: 266px;
    height: 219px;
    background: #FFFFFF;
    box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.09);
    border-radius: 2px;
    margin: 10px;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    .title{
      overflow: hidden;
      display: flex;
      line-height: 24px;
      img{
        width: 24px;
        height: 24px;
        // background-color: black;
        margin-right: 16px;
      }
      h1{
        color: rgba(0, 0, 0, 0.85);
        font-size: 16px;
        font-weight: 500;
        margin: 0;
      }
    }
    .item-c{
      margin-top: 10px;
      display: flex;
      justify-content: space-between;
      padding-left: 37px;
      position: relative;
      span{
        font-size: 14px;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.45);
        line-height: 32px;
      }
      .detail{
        font-size: 18px;
        font-weight: bold;
        color: rgba(0, 0, 0, 0.65);
        line-height: 32px;
        overflow: hidden;
        img{
          margin-right: 4px;
          float: left;
          width: 18px;
          height: 18px;
        }
      }
    }
    .bot{
      position: absolute;
      left: 0;
      bottom: 0;
      height: 39px;
      background-color: rgba(65, 203, 137, 0.2);
      color: rgba(46, 161, 33, 1);
      font-size: 16px;
      line-height: 39px;
      width: 100%;
      text-align: center;
      cursor: pointer;
      font-weight: bold;
    }
  }
}
.class-body{
  display: flex;
  margin-bottom: 25px;
  margin-right: 20px;
  .name{
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 36px;
    padding-right: 20px;
  }
  .right{
    display: flex;
    .right-btn{
      user-select: none;
      cursor: pointer;
      margin-right: 10px;
      height: 36px;
      line-height: 36px;
      border: 1px solid #D9D9D9;
      padding: 0 20px;
      border-radius: 4px;
      color: rgba(0, 0, 0, 0.85);
      &.active{
        color: rgba(65, 203, 137, 1);
        border: 1px solid rgba(65, 203, 137, 1);
      }
    }
  }
}
.top-header{
  background-color: white;
  overflow: hidden;
  position: absolute;
  top: -70px;
  width: 100%;
  height: 80px;
  line-height: 80px;
  padding: 0 25px;
  left: 0;
  .left{
    float: left;
    display: flex;
    align-items: center;
    img{
      width: 15px;
    }
    span{
      margin-left: 10px;
      width: 80px;
      font-size: 20px;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
    }
  }
  .right{
    float: right;
    display: flex;
    align-items: center;
    .right-item{
      margin-right: 20px;
      width: 120px;
    }
    .last{
      color: #1890FF;
      font-size: 14px;
    }
  }

}
.CustomerList{
  position: relative;
  padding: 25px;

  .center{
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-right: 20px;
    padding: 25px;
    background-color: white;
  }
}

::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #41cb89;   // 进行修改背景和字体
  color: #fff;
}
.pagin{
  margin-top: 25px;
  text-align: right;
}
</style>
